package com.sjgtw.cloud.web.rainfallGauge.controller;

import java.util.List;
import java.util.Map;

import com.sjgtw.cloud.common.core.web.controller.BaseController;
import com.sjgtw.cloud.common.core.web.domain.AjaxResult;
import com.sjgtw.cloud.common.core.web.page.TableDataInfo;
import com.sjgtw.cloud.web.rainfallGauge.domain.RainfallGauge;
import com.sjgtw.cloud.web.rainfallGauge.service.IRainfallGaugeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 雨量计管理Controller
 * 
 * @author ruoyi
 * @date 2024-03-17
 */
@RestController
@Api(tags = "3.1、雨量器管理")
@RequestMapping("/rainfallGauge")
public class RainfallGaugeController extends BaseController
{
    @Autowired
    private IRainfallGaugeService rainfallGaugeService;

    /**
     * 查询雨量计管理列表
     */
    //@RequiresPermissions("system:rainfallGauge:list")
    @GetMapping("/list")
    @ApiOperation("列表")
    public TableDataInfo list(RainfallGauge rainfallGauge)
    {
        startPage();
        List<Map<String,Object>> list = rainfallGaugeService.selectRainfallGaugeList(rainfallGauge);
        return getDataTable(list);
    }


    /**
     * 新增雨量计管理
     */
    @ApiOperation("新增雨量计管理")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody RainfallGauge rainfallGauge)
    {

        return toAjax(rainfallGaugeService.insertRainfallGauge(rainfallGauge));
    }

    /**
     * 修改雨量计管理
     */
    @ApiOperation("修改雨量计管理")
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody RainfallGauge rainfallGauge)
    {
        return toAjax(rainfallGaugeService.updateRainfallGauge(rainfallGauge));
    }

    /**
     * 删除雨量计管理
     */
    @ApiOperation("删除雨量计管理")
	@DeleteMapping("/delete/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(rainfallGaugeService.deleteRainfallGaugeById(id));
    }
}
